<!--  -->
<template>
  <div>登录页面

    {{ captchaData.data.imageCode }}
    <img :src="captchaData.data.imageCode">
    <el-button type="primary">Primary</el-button>
    <el-button type="success">Success</el-button>
  </div>
</template>
<script lang='ts' setup>
import { reactive, toRefs, ref, onMounted } from 'vue'
import { getCaptcha } from '../../apis/auth/auth';
import { Captcha } from '../../apis/auth/type';

//vue定义响应式数据 ref  reactive

let captchaData = reactive<{ data: Captcha }>({
  data: {
    id: "",
    imageCode: ""
  }
})
//promise解决 回调地狱问题    async 把异步变成同步 解决链式问题
const getCaptchaData = async () => {
  const res = await getCaptcha();
  console.log(11111111, res);
  // Object.assign(captchaData, res.data)

  captchaData.data=res.data;
}

getCaptchaData();

</script>
<style scoped></style>